Skip to content

Keep config.php group-writable#57874

Open
lafrech wants to merge 1 commit intonextcloud:masterfrom
lafrech:configFilePath-0660
Open

Keep config.php group-writable#57874
lafrech wants to merge 1 commit intonextcloud:masterfrom
lafrech:configFilePath-0660

Conversation

@lafrech
Copy link

@lafrech lafrech commented Jan 28, 2026

Summary

This changes makes config.php group-writable.

This is useful when Nextcloud is installed in a directory with ownership shared between webserver (www-data) and a user with FTP or SSH access, so that the installation/update script may be run as user (CLI) without Nextcloud failing due to www-data not being able to write to the file, or as www-data (from web interface) without the user being unable to move/delete the file from their own cloud space (e.g. to delete Nextcloud).

One may use the setgid bit to ensure all files are owned by a common group, or ACL to ensure user and www-data can read/write all files, but the current chmod break that.

This change keeps the config not readable by others, as specified in the comment.

(See https://help.nextcloud.com/t/installing-nextcloud-in-user-home-directory-on-shared-server/238081/3.)

Checklist

Signed-off-by: Jérôme Lafréchoux <jerome@jolimont.fr>
@lafrech lafrech requested a review from a team as a code owner January 28, 2026 13:30
@lafrech lafrech requested review from ArtificialOwl, icewind1991, salmart-dev and sorbaugh and removed request for a team January 28, 2026 13:30
@CarlSchwan
Copy link
Member

I don't think this is a great idea in term of security. What do you think @nextcloud/security ?

@lafrech
Copy link
Author

lafrech commented Jan 28, 2026

All the other files are group-writable so anyone in the owning group can do pretty much anything already. (At least in my own installation, but I think this is standard.)

Depending on the installation, the owning group should be www-data, the user's default group, or a dedicated group created on purpose.

But I'm interested in the security team's POV, as I have no expertise in Nextcloud administration.

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ My local dev environment has the same patch applied since a long time 🙈
I hesitated to send it as a patch, as it feels off.

All the other files are group-writable so anyone in the owning group can do pretty much anything already. (At least in my own installation, but I think this is standard.)

That is not recommended and also documented like that in step 13 of the update manual:
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/manual_upgrade.html#step-by-step-manual-upgrade


But long story short, we can do the same trick as with the log file and add a config that has the permissions:

/**
* Log file mode for the Nextcloud logging type in octal notation.
*
* Defaults to ``0640`` (writable by user, readable by group).
*/
'logfilemode' => 0640,

@lafrech
Copy link
Author

lafrech commented Jan 29, 2026

But long story short, we can do the same trick as with the log file and add a config that has the permissions:

Yes. I didn't know about logfilemode. It makes sense to do the same for the config file.

@github-actions
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@nickvergessen
Copy link
Member

@lafrech you want to do that change? Or should we take over?

@lafrech
Copy link
Author

lafrech commented Feb 15, 2026

The scope of the change appears to be wider than I expected, and I'm not familiar with the codebase.

You may take over if you agree with the feature.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants